class sum_prime {
    public static void main (String[] args){
        int sum = 2;
        int numPrimes = 0;
        int number = 2;
        while (numPrimes<999) {
            for (int i =2;i<number;i++) {
                if(number%i ==0) break;
                else if (i==number-1) {
                    numPrimes++;
                    sum = sum + number;
                }
            }
            number++;
        }
        System.out.printf("%d%n",sum);
    }
}